Propose SIP-34 onActivityItem handler / hook#179
Conversation
| ```json | ||
| { | ||
| "initialPermissions": { | ||
| "endowment:activity-item-insight": { |
There was a problem hiding this comment.
I think we can drop the -item here.
| "endowment:activity-item-insight": { | |
| "endowment:activity-insight": { |
| 2. The parameters passed to the `onActivityItem` function should also include information about confirmations for the activity item / transaction | ||
|
|
||
| ``` | ||
| import type { OnActivityItemHandler } from "@metamask/snaps-sdk"; |
There was a problem hiding this comment.
Can you add a definition for this type?
| // should this be `activityItem` instead or is `Activity` only ever transactions? | ||
| // `transaction` param should also include details about tx / block confirmations |
There was a problem hiding this comment.
We should figure this out before merging. 😅
|
|
||
| One of the perks of this proposal is that we can more or less mimic the `onTransaction` and `onSignature` handlers. The main two differences will be the following: | ||
|
|
||
| 1. Different entry-point (I will leave this part to you) |
There was a problem hiding this comment.
By "entry point" I just meant the area in the code / UI where the on_____ hooks into. I expect much of the parameters to be the same as onTransaction and onSignature (transaction, transactionOrigin, chainId), just with some extra information about confirmations and whatever other info developers want. Maybe currentStatus, timestamps (submitted and confirmation time), block number and block hash, info about gas used, transaction hash and nonce,
Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
|
I cannot push directly to this branch anymore because I no longer work for MetaMask. Here is the content of what I'd like the PR from personal fork: #182 sip: 34
|
Related to issue: MetaMask/snaps#3520
The purpose of this SIP is to add a new Snap lifecycle hook:
onActivityItem(feel free to use your own name for it).
This event will be triggered when someone clicks on an activity item (ie past transaction) and will optionally provide Snap developers with an area (like
onTransactionandonSignature) at the bottom of the modal below:This
onActivityItemhook will pass the Snap developer information about the transaction, as well as information about the transactions status (eg confirmed, rejected / failed, pending, etc) which a Snap developer can use to provider insights to end-usersNote
Introduces SIP-34 describing an
onActivityItemlifecycle hook for activity items and a newendowment:activity-item-insightpermission.SIPS/sip-34.mdonActivityItemlifecycle hook triggered on activity item (transaction) click, with confirmations and optional origin.endowment:activity-item-insightpermission (allowActivityItemOriginoption) for accessing activity item details.Written by Cursor Bugbot for commit 660de5a. This will update automatically on new commits. Configure here.